/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DataStructures;


import DataSelection.Query;
import DataStructures.Globals;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author Manuel
 */
public class Property{

    private int granularity;
    private Query query;
    private String name;
    private boolean optional;
    private String concept;

    public Property() {
        granularity = -1;
    }

    public Property(Query query) {
        this.query = query;
        granularity = -1;
    }

    
    public Property(int g, Query q){
        granularity = g;
        query = q;
    }

    public int getGranularity() {
        return granularity;
    }

    public void setGranularity(String granularity) {
        if(granularity.toLowerCase().equals("class"))
            this.granularity= Globals.PROPERTY_LEVEL_CLASS;
        else if (granularity.toLowerCase().equals("project"))
            this.granularity = Globals.PROPERTY_LEVEL_PROJECT;
    }

    public Query getQuery() {
        return query;
    }

    public void setQuery(Query query) {
        this.query = query;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isOptional() {
        return optional;
    }

    public void setOptional(boolean optional) {
        this.optional = optional;
    }

    public String getConcept() {
        return concept;
    }

    public void setConcept(String concept) {
        this.concept = concept;
    }

    public boolean isOfConcept(String concept){
        if(this.concept.toLowerCase().equals(concept.toLowerCase()))
            return true;
        else
            return false;
    }

    public boolean hasAllComponents() {
        if(this.granularity != -1 && this.name != null && this.query != null && this.concept != null)
            return true;
        else
            return false;
    }
    

}
